
var id = '';
id = getvl("id");
modify(id);

function modify(id) {

	$.ajax({
			url: urlcore + "/api/paramSetting/selectOne?id=" + id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					var da = data.data;

					var status = "";
					if(da.status == 1) {
						status = "可用";
					} else if(da.status == 2) {
						status = "已禁用";
					}

					$('#id').html(da.id);
					$('#limitDays').val(da.limitDays);
					$('#interestPercent').val(da.interestPercent);
					$('#overduePercent').val(da.overduePercent);

				}
			
		},
		error: function() {
			/* Act on the event */
			alert("error");
		}
	});
}


function subMsg(){
	var limitDays = $('#limitDays').val();
   if(limitDays==''){
     	alert("贷款期限不能为空！");
     	return false;
     }
   var interestPercent = $('#interestPercent').val();
   if(interestPercent==''){
     	alert("利息不能为空！");
     	return false;
     }
    var overduePercent = $('#overduePercent').val();
   if(overduePercent==''){
     	alert("逾期日利率不能为空！");
     	return false;
     }
        
     $.ajax({
        url:  urlcore +"/api/paramSetting/update",
        type: "post",
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify({
            "id": id,
            "limitDays":limitDays,
            "interestPercent": interestPercent,
            "overduePercent":overduePercent,
            
        }),
        dataType: "json",
        success:function(data){
            if (data.success == true) {
                
                    alert("修改成功");
                    //跳转列表页
                    window.location.href = "param_setting_list.html";
                  } else if (data.code == 'OVERTIME') {
                var thisUrl = window.location.href;
                if (thisUrl.indexOf('login.html') <= -1) {
                    top.window.location.href = "login.html";
                }
            } else {
                alert(data.msg);
            }

        },
        error: function() {
            alert("error");
        }

    });
	
	
}
